package com.cgx.tablet.beeper.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

/**
 * @author Created by GammaQ.
 * @version V1.0
 * @FileName: vwoof.com.xundaobaoclient.adapter.FragmentsPagerAdapter.java
 * @date:2016-04-19 10:54
 */
public class FragmentsPagerAdapter extends FragmentPagerAdapter {
    private String[] titles;
    private final Fragment[] fragments;

    public FragmentsPagerAdapter(FragmentManager fragmentManager, String[] titles, Fragment[] fragments) {
        super(fragmentManager);
        this.titles = titles;
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments[position];
    }

    @Override
    public int getCount() {
        return fragments.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }

    public void setTitles(String[] titles) {
        this.titles = titles;
    }
}

